package com.china08.yxyapi.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import com.china08.yxyapi.model.YxyApiReqModel;

@Aspect
@Component
public class AutoCheckAspect {

    @Before("@annotation(io.swagger.annotations.ApiOperation)")
    private void aotoCheck(JoinPoint joinPoint) {
        Object[] args = joinPoint.getArgs();
        for (Object arg : args) {
            if (arg instanceof YxyApiReqModel) {
                YxyApiReqModel apiReqModel = (YxyApiReqModel) arg;
                apiReqModel.autoCheck();
            }
        }
    }

}
